package com.show.business.device.controller;
import com.show.business.common.core.controller.BaseController;
import com.show.business.device.bean.DeviceAlarm;
import com.show.business.device.service.IDeviceAlarmService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 设备告警 前端控制器
 * </p>
 *
 * @author dvlp
 * @since 2024-09-30
 */
@Api(value = "设备告警",description = "设备告警")
@RestController
@RequestMapping("/device/deviceAlarm")
public class DeviceAlarmController extends BaseController {
    @Resource
    private IDeviceAlarmService deviceAlarmService;
    /**
     * 获取设备告警列表
     */
    @ApiOperation("获取设备告警列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "Integer", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "pageSize", value = "每页大小", dataType = "Integer", dataTypeClass = Integer.class)
    })
    @GetMapping("/page")
    public Object getPage(DeviceAlarm deviceAlarm) {
        startPage();
        List<DeviceAlarm> list = deviceAlarmService.getList(deviceAlarm);
        return getDataTable(list);
    }
    /**
     * 删除设备告警
     */
    @ApiOperation("删除")
    @ApiImplicitParam(name = "id", value = "主键ID", required = true, dataType = "String", dataTypeClass = String.class)
    @DeleteMapping("/del")
    public Object del(@RequestParam String[] id) {
        return deviceAlarmService.delInfos(id);
    }
    /**
     * 设备告警详情
     */
    @ApiOperation("详情")
    @ApiImplicitParam(name = "id", value = "主键ID", required = true, dataType = "String", dataTypeClass = String.class)
    @GetMapping("/info")
    public Object getDeviceAlarm(@RequestParam String id) {
        return deviceAlarmService.getInfo(id);
    }

    /**
     * 获取设备告警列表
     */
    @ApiOperation("获取设备告警列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "Integer", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "pageSize", value = "每页大小", dataType = "Integer", dataTypeClass = Integer.class)
    })
    @GetMapping("/alarmListByImei")
    public Object getAlarmListByImei(DeviceAlarm deviceAlarm) {
        startPage();
        List<DeviceAlarm> list = deviceAlarmService.getAlarmListByImei(deviceAlarm);
        return getDataTable(list);
    }
}
